﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Windows.Forms;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Nmo;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Trace;
using Entity;

namespace DataControls
{
    public class HEDAOTAO_Data
    {
        DataBaseAccess dataBaseAccess = new DataBaseAccess();

        public void hedaotao_Combobox(ComboBox cbHeDaoTao)
        {
            String excuteString = "SELECT * FROM HEDAOTAO";
            dataBaseAccess.addto_Combobox(cbHeDaoTao, excuteString);
        }

        public Boolean kiemtraMaHDT_LopHoc(String mahedaotao)
        {

            String excuteString = "SELECT COUNT(*) FROM LOPHOC WHERE MAHDT='" + mahedaotao + "'";
            int i = dataBaseAccess.Test(excuteString);
            if (i > 0)
                return true;
            else
                return false;
        }

        public Boolean kiemtra_MaHeDaoTao(String mahedaotao)
        {
            
            String excuteString = "SELECT COUNT(*) FROM HEDAOTAO WHERE MAHDT='" + mahedaotao + "'";
           int i  = dataBaseAccess.Test(excuteString);
            if (i > 0)
                return true;
            else
                return false;
        }

        public Boolean kiemtra_TenHeDaoTao(String tenhedaotao)
        {
            
            String excuteString = "SELECT COUNT(*) FROM HEDAOTAO WHERE TENHDT='" + tenhedaotao + "'";
            int i = dataBaseAccess.Test(excuteString);
            if (i > 0)
                return true;
            else
                return false;
        }
    }
}
